<?php

class Bootstrap extends \Yaf\Bootstrap_Abstract
{
    /**
     * 注册composer
     */
    public function _initAutoload(\Yaf\Dispatcher $dispatcher) {
        // Autoload 自动载入
        require "D:/phpstudy_pro/WWW/ctrl/vendor/autoload.php";
    }

    public function _initRest(\Yaf\Dispatcher $dispatcher)
    {
        $dispatcher->autoRender(false);
        $dispatcher->disableView();
        \TC\Di\Container::set('Yaf_Com_Dispatcher',$dispatcher);
    }

    //初始化插件
    public function _initPlugin(\Yaf\Dispatcher $dispatcher)
    {
        $objHookPlugin = new HookPlugin();
        $dispatcher->registerPlugin($objHookPlugin);
    }

    //初始化Redis缓存
    public function _initRedis(\Yaf\Dispatcher $dispatcher)
    {
        $redisConfig = \Yaf\Application::app()->getConfig()->toArray()['redis'];

        $redisConfig['class']  = \TC\Cache\Redis::class;
        \TC\Di\Container::set('redis',$redisConfig);

    }

    //初始化服务
//    public function _initService(\Yaf\Dispatcher $dispatcher)
//    {
//
//        \TC\Di\Container::set('service',[
//            'class'  => 'TC\Sdk\Service',
//            'redis'  =>  \TC\Di\Container::get('redis')
//        ]);
//        echo 1;die;
//    }
    //初始化日志
//    public function _initLog(){
//         \SeasLog::setBasePath("D:/phpstudy_pro/WWW/ctrl/Log");
//         \SeasLog::setLogger('rest');
//    }

}